package com.yuwei.base.view

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.blankj.utilcode.util.ToastUtils

open abstract class BaseMVVMActivity<VDB:ViewDataBinding>:AppCompatActivity() {
    protected lateinit var binding:VDB
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        //获取布局绑定代理对象
        binding = DataBindingUtil.setContentView(this,getLayoutId())
        //初始化
        initView()
    }
    protected fun showToast(msg:String){
        if (msg.isEmpty()){
            ToastUtils.showLong(msg)
        }
    }
    abstract fun initView()

    abstract fun getLayoutId(): Int
}